<template>
  <div class="data-box flex-shrink-0" :style="{ minWidth: allWidth ? '738px' : type === 1 ? '404px' : '708px' }">
    <div class="data-box-title">数据概况</div>
    <a-row class="data-box-items" :gutter="12">
      <a-col :span="dataObj.length > 3 ? 8 : 12" v-for="(item, index) in dataObj" :key="index">
        <div class="data-box-item">
          <p class="item-title">{{ item.name || 'title' }}{{ item.isMoney ? '（元）' : '' }}</p>
          <p class="item-num df" v-if="item.isMoney">
            <a-tooltip v-if="item.value && item.value.toString().length > 10">
              <template slot="title">
                <span class="item-num">{{ item.value / 100 || 0 }}</span>
              </template>
              <a-statistic :value="item.value / 100" style="margin-right: 50px" />
            </a-tooltip>
            <a-statistic v-else :value="item.value / 100" style="margin-right: 50px" />
          </p>
          <a-statistic class="item-num" v-else :value="item.value" />
        </div>
      </a-col>
    </a-row>
  </div>
</template>
<script>
export default {
  name: 'dataStatic',
  props: {
    dataObj: {
      type: Array,
      default: () => []
    },
    allWidth: {
      type: Boolean,
      default: false
    },
    type: {
      type: Number,
      default: 0
    }
  },
  watch: {
    dataObj(val) {
      // console.log(val)
    }
  },
  data() {
    return {}
  },
  mounted() {}
}
</script>
<style lang="less" scoped>
.data-box {
  height: 328px;
  min-width: 695px;
  background: #fcfcfc;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  padding: 20px 10px 18px 15px;
  margin-right: 2px;
  margin-bottom: 10px;
  flex: 1;
  &-title {
    font-size: 18px;
    font-weight: bold;
    color: #333333;
    margin-bottom: 16px;
  }
  &-items {
    justify-content: space-around;
    margin-bottom: 20px;
    width: 100%;
    margin-left: -3px;
  }
  &-items:last-child {
    margin: 0;
  }
  &-item {
    background: #f5f5f5;
    border-radius: 8px;
    height: 113px;
    // width: calc(100% / 3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    .item-title {
      font-size: 14px;
      color: #999999;
      margin-bottom: 0px;
    }
    .item-num {
      font-size: 24px;
      font-family: AlibabaPuHuiTi_2_65_Medium;
      color: #333333;
      font-weight: 500;
      margin-bottom: 0;
      cursor: pointer;
      // justify-content: center;
    }
  }
}
</style>
